// 加载path模块
let path = require("path");
// 加载 html托管内存模块
let htmlWebpackPlugin = require("html-webpack-plugin");

//  配置webpack
module.exports = {
  entry: path.join(__dirname, "./src/main.js"),
  output: {
    path: path.join(__dirname, "./dist"),
    filename: "bundle.js"
  },
  plugins: [
    new htmlWebpackPlugin({
      template: "./src/index.html",
      filename: "index.html"
    })
  ],
  module: {
    rules: [
      { test: /\.vue$/, use: "vue-loader" },
      { test: /\.css$/, use: ["style-loader", "css-loader"] },
      { test: /\.(scss|sass)$/, use: ["style-loader", "css-loader", "sass-loader"] },
      { test: /\.less$/, use: ["style-loader", "css-loader", "less-loader"] },
      { test: /\.(gif|png|jpg|jpeg|bmp)$/, use: "url-loader?limit=30000" },
      {test:/\.js$/,use:"babel-loader",exclude:/node_modules/}
    ]
  }
}